home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / character.lua < prev    next >
Text File  |  2004-01-29  |  42KB  |  1,172 lines

  1. -- character state machine
  2. -- called by init
  3. -- this: characterGO
  4. function initCharacter()
  5.     -- this function is called when the characters is newly created
  6.     -- set the time the character needs from getting up to getting to work
  7.     this.storeData("workPrepareTime", tonumber(readConfig("Game", "workPrepareTime")));
  8.     -- set the minimum time the character thinks between actions
  9.     this.storeData("minThinkTime", tonumber(readConfig("Game", "minThinkTime")));
  10.     -- set the maximal time the character thinks between actions
  11.     this.storeData("maxThinkTime", tonumber(readConfig("Game", "maxThinkTime")));
  12. end
  13.  
  14.  
  15. beginStateMachine()
  16.     
  17.     onEnter(function(msg)
  18.         -- preload animations
  19.         
  20.         --print("character::onEnter archtype: " .. getArchtypeSuffix(this));
  21.         
  22.         -- walk
  23.         local wso = this.walkSO;
  24.         wso.preloadAnimation(archize(this, "stand1"));
  25.         wso.preloadAnimation(archize(this, "stand2"));
  26.         wso.preloadAnimation(archize(this, "stand3"));
  27.         wso.preloadAnimation(archize(this, "stand4"));
  28.         wso.preloadAnimation(archizeWalk(this, "stand-walkLFF-"));
  29.         wso.preloadAnimation(archizeWalk(this, "walkRFF-walkLFF-"));
  30.         wso.preloadAnimation(archizeWalk(this, "walkLFF-walkRFF-"));
  31.  
  32.         -- mimic
  33.         local mso = this.mimicSO;
  34.         mso.preloadAnimation("mimicEyeBlink");
  35.         mso.preloadAnimation("mimicNeutral1");
  36.         mso.preloadAnimation("mimicNeutral2");
  37.         mso.preloadAnimation("mimicNeutral3");
  38.         mso.preloadAnimation("mimicEyeClose");
  39.         mso.preloadAnimation("mimicSmile1");
  40.         mso.preloadAnimation("mimicSmile2");
  41.         mso.preloadAnimation("mimicSmile3");
  42.         mso.preloadAnimation("mimicSmile4");
  43.         mso.preloadAnimation("mimicSmile5");
  44.         mso.preloadAnimation("mimicAngry1");
  45.         mso.preloadAnimation("mimicSad1");
  46.     end)
  47.     
  48.     onMsg("init", function(msg)
  49.         initCharacter();
  50.     end )
  51.     
  52.     onMsg("buildMenu", function(msg)
  53.         local currentCharacter = getStateObjectFromID(msg.sender);
  54.         print("character buildMenu " .. currentCharacter.getCharacterName().. "->" .. this.getCharacterName());
  55.         -- build the pie menu
  56.         clearPieMenu();
  57.         local button ;
  58.         
  59. --        local bed = this.getObjectWithActivity("sleep");
  60. --        if (bed and bed.hasBehavior("")) then
  61. --            button = addPieMenuButton("pm_getIntimateBed", "getIntimateBed");
  62. --            button.addDescription(ACTIVITY, "getIntimateBed");
  63.             --button.addDescription(DONTQUEUE, "true");
  64. --        end
  65.         
  66.         
  67.         local ibed = getInteractionBed(this, currentCharacter);
  68.         if (ibed) then
  69.         
  70. --            button = addPieMenuButton("pm_kissBed", "kissBed");
  71. --            button.addDescription(ACTIVITY, "kissBed");
  72.         
  73.             button = addPieMenuButton("pm_pettingBed", "pettingBed");
  74.             button.addDescription(ACTIVITY, "pettingBed");
  75.         
  76.             local bothMale = ( 
  77.                 (currentCharacter.getGameObjectServer().getCharacter(ELAINE).isTransgender()) and
  78.                 (not currentCharacter.getGameObjectServer().getCharacter(MIKE).isTransgender())
  79.                 );
  80.                 
  81.             local bothHomo = ( 
  82.                 (currentCharacter.getGameObjectServer().getCharacter(ELAINE).isTransgender()) and
  83.                 (currentCharacter.getGameObjectServer().getCharacter(MIKE).isTransgender())
  84.                 );
  85.                 
  86.             
  87.             if (not bothMale) and (not bothHomo) then
  88.                 button = addPieMenuButton("pm_sexBed", "sexBed");
  89.                 button.addDescription(ACTIVITY, "sexBed");
  90.             end
  91.         else
  92.         
  93.         end
  94.                 
  95.         
  96.         if ((not bed) and (not ibed) and (not (this.isSwimming()))) then        
  97.         --if ((not bed) and (not ibed)) then
  98.                 
  99.                 
  100.             local romanceButton = addPieMenuButton("pm_romance", "");
  101.             romanceButton.addIcon("guiIconRelationshipRomantic");
  102.             
  103.                 button = romanceButton.addPieMenuButton("pm_talkRelation", "talk", "Relation");
  104.                 button.addDescription(ACTIVITY, "talkRelation");
  105.                 
  106.                 button = romanceButton.addPieMenuButton("pm_talkCompliment", "talk", "Compliment");
  107.                 button.addDescription(ACTIVITY, "talkCompliment");
  108.                 
  109.                 button = romanceButton.addPieMenuButton("pm_holdNice", "holdNice");
  110.                 button.addDescription(ACTIVITY, "holdNice");
  111.                 
  112.                 button = romanceButton.addPieMenuButton("pm_kissFriendly", "kiss", "Friendly");
  113.                 button.addDescription(ACTIVITY, "kissFriendly");
  114.  
  115.                 button = romanceButton.addPieMenuButton("pm_kissIntimate", "kiss", "Intimate");
  116.                 button.addDescription(ACTIVITY, "kissIntimate");
  117.                 
  118.                 button = romanceButton.addPieMenuButton("pm_talkILoveYou", "talk", "ILoveYou");
  119.                 button.addDescription(ACTIVITY, "talkILoveYou");
  120.  
  121.                 if (canMarry(currentCharacter, this)) then
  122.                     button = romanceButton.addPieMenuButton("pm_talkMarryMe", "talkMarryMe", "");
  123.                     button.addIcon("guiIconRelationErotic");
  124.                     button.addIcon("guiIconRelationFriendship");
  125.                     button.addDescription(ACTIVITY, "talkILoveYou");
  126.                 end
  127.  
  128.  
  129.  
  130.             local eroticButton = addPieMenuButton("pm_erotic", "");
  131.             eroticButton.addIcon("guiIconLibido");
  132.         
  133.                 button = eroticButton.addPieMenuButton("pm_talkFlirt", "talk", "Flirt");
  134.                 button.addDescription(ACTIVITY, "talkFlirt");
  135.                 
  136.                 button = eroticButton.addPieMenuButton("pm_kissSexy", "kissSexy", "Sexy"); -- special kiss
  137.                 button.addDescription(ACTIVITY, "kissSexy");
  138.                 
  139.                 if (currentCharacter.isMale()) then
  140.                     button = eroticButton.addPieMenuButton("pm_holdBehind", "holdBehind");
  141.                     button.addDescription(ACTIVITY, "holdBehind");
  142.                 end;
  143.                 
  144.                 button = eroticButton.addPieMenuButton("pm_getIntimateBed", "getIntimateBed");
  145.                 button.addDescription(ACTIVITY, "getIntimateBed");
  146.                 
  147.                 
  148.                 local sofa = this.getObjectWithActivity("sit");
  149.                 if (sofa and sofa.hasBehavior("sofa")) then
  150.                     button = eroticButton.addPieMenuButton("pm_getIntimateSofa", "getIntimateSofa");
  151.                     button.addDescription(ACTIVITY, "kissIntimate");
  152.                 end
  153.                 
  154.                 
  155.             local otherButton = addPieMenuButton("pm_other", "");
  156.             otherButton.addIcon("guiIconSpass");
  157.             
  158.                 button = otherButton.addPieMenuButton("pm_talkJoke", "talk", "Joke");
  159.                 button.addDescription(ACTIVITY, "talkJoke");
  160.                 
  161.                 button = otherButton.addPieMenuButton("pm_talkTease", "talk", "Tease");
  162.                 button.addDescription(ACTIVITY, "talkTease");
  163.  
  164.  
  165.             local friendshipButton = addPieMenuButton("pm_friendship", "");
  166.             friendshipButton.addIcon("guiIconRelationshipFriendship");
  167.  
  168.                 button = friendshipButton.addPieMenuButton("pm_talkCasual", "talk", "Casual");
  169.                 button.addDescription(ACTIVITY, "talkCasual");
  170.                 
  171.                 button = friendshipButton.addPieMenuButton("pm_talkGossip", "talk", "Gossip");
  172.                 button.addDescription(ACTIVITY, "talkGossip");
  173.  
  174.                 button = friendshipButton.addPieMenuButton("pm_talkComfort", "talk", "Comfort");
  175.                 button.addDescription(ACTIVITY, "talkComfort");
  176.  
  177.                 button = friendshipButton.addPieMenuButton("pm_talkHobby", "talk", "Hobby");
  178.                 button.addDescription(ACTIVITY, "talkHobby");
  179.                 
  180.                 
  181. --            button = addPieMenuButton("pm_kissFriendly", "kiss", "Friendly");
  182. --            button.addDescription(ACTIVITY, "kissFriendly");
  183. --            
  184. --            button = addPieMenuButton("pm_kissNice", "kiss", "Nice");
  185. --            button.addDescription(ACTIVITY, "kissNice");
  186. --            
  187. --            button = addPieMenuButton("pm_kissIntimate", "kiss", "Intimate");
  188. --            button.addDescription(ACTIVITY, "kissIntimate");
  189. --            
  190. --            button = addPieMenuButton("pm_kissSexy", "kissSexy", "Sexy"); -- special kiss
  191. --            button.addDescription(ACTIVITY, "kissSexy");
  192.  
  193. --            button = addPieMenuButton("pm_talkCasual", "talk", "Casual");
  194. --            button.addDescription(ACTIVITY, "talkCasual");
  195. --            
  196. --            button = addPieMenuButton("pm_talkGossip", "talk", "Gossip");
  197. --            button.addDescription(ACTIVITY, "talkGossip");
  198. --
  199. --            button = addPieMenuButton("pm_talkFlirt", "talk", "Flirt");
  200. --            button.addDescription(ACTIVITY, "talkFlirt");
  201. --            
  202. --            button = addPieMenuButton("pm_talkHobby", "talk", "Hobby");
  203. --            button.addDescription(ACTIVITY, "talkHobby");
  204. --            
  205. --            button = addPieMenuButton("pm_talkRelation", "talk", "Relation");
  206. --            button.addDescription(ACTIVITY, "talkRelation");
  207. --            
  208. --            button = addPieMenuButton("pm_talkJoke", "talk", "Joke");
  209. --            button.addDescription(ACTIVITY, "talkJoke");
  210. --            
  211. --            button = addPieMenuButton("pm_talkCompliment", "talk", "Compliment");
  212. --            button.addDescription(ACTIVITY, "talkCompliment");
  213. --            
  214. --            button = addPieMenuButton("pm_talkILoveYou", "talk", "ILoveYou");
  215. --            button.addDescription(ACTIVITY, "talkILoveYou");
  216. --            
  217. --            button = addPieMenuButton("pm_talkArgue", "talk", "Argue");
  218. --            button.addDescription(ACTIVITY, "talkArgue");
  219. --            
  220. --            button = addPieMenuButton("pm_talkComfort", "talk", "Comfort");
  221. --            button.addDescription(ACTIVITY, "talkComfort");
  222. --            
  223. --            button = addPieMenuButton("pm_talkTease", "talk", "Tease");
  224. --            button.addDescription(ACTIVITY, "talkTease");
  225.             
  226.             --button = addPieMenuButton("pm_talkCutscene", "talkCutscene");
  227.         
  228.         end;
  229.         
  230.         
  231. --        local sofa = this.getObjectWithActivity("sit");
  232. --        local wsoMachineName = this.walkSO.getStateMachine().getName();
  233. --        print("wsoMachineName: " , wsoMachineName);
  234. --        if (sofa and sofa.hasBehavior("sofa") and (wsoMachineName == "sofaChar")) then
  235. --            button = addPieMenuButton("pm_getIntimateSofa", "getIntimateSofa");
  236. --            button.addDescription(ACTIVITY, "kissIntimate");
  237. --        end
  238.  
  239.  
  240.         
  241.         local hasGift = holdsObject(currentCharacter, "gift");
  242.         --print("hasGift: " , hasGift);
  243.         if (hasGift) then
  244.             button = addPieMenuButton("pm_giveGift", "giveGift");
  245.             button.addDescription(ACTIVITY, "giveGift");
  246.         end
  247.         
  248.     end )
  249.     
  250.  
  251.  
  252.  
  253.     -- generic talk
  254.     onMsg("talk", function(msg)
  255.         
  256.         -- get the game object server
  257.         local gameObjectServer = getGameObjectServer();
  258.         -- get character who initiated this action
  259.         local character = getStateObjectFromID(msg.sender);
  260.         -- get the suffix
  261.         local talkType = msg.data;
  262.         
  263.         print(">>>>> onMsg talk" .. msg.data .." character " .. character.getCharacterName() .. " -> " .. getCharacterName());
  264.         
  265.         --if (instantAbortIfNotIdle(character, this)) then return end;
  266.         
  267.         if instantAbortIfUnhappy(character, "talk" .. talkType, this) then return end;        
  268.         
  269.         
  270.         -- check if the activity is possible
  271. --        if (activityPossible(character, msg.name, this) and isIdle(this)) then
  272.         if (activityPossible(character, "talk" .. talkType, this)) then
  273.         
  274.             -- walk to the interaction point
  275.             local interactionPoint = findInteractionPoint("talk", character);
  276.             if (interactionPoint) then
  277.                 -- get the walk state objects
  278.                 local wso = character.walkSO;
  279.                 local thisWso = this.walkSO;
  280.                 -- create state machine contexts
  281.                 local wsoContext =  StateMachineContext();
  282.                 local thisWsoContext =  StateMachineContext();
  283.                 -- store the partners
  284.                 wsoContext.storeStateObject("partner", thisWso);
  285.                 wsoContext.storeData("activePart", true);
  286.                 wsoContext.storeData("talkType", talkType);
  287.                 thisWsoContext.storeStateObject("partner", wso);
  288.                 thisWsoContext.storeData("activePart", false);
  289.                 thisWsoContext.storeData("talkType", talkType);
  290.                 thisWsoContext.storeData("waitLong", isIdle(this));
  291.                 -- start action for other character
  292.                 if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  293.                     -- wso.queueMessage("waitForChar", this, "talk", wsoContext);
  294.                     wso.queueStateMachine("interaction.talk", this, wsoContext);
  295.                     
  296.                     -- queue walk and state change msg for this(passive) character
  297.                     local passiveMsg = QueuedMessage();
  298.                     -- passiveMsg.set("waitForChar", this.getUniqueID(), "talk", thisWsoContext);
  299.                     passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.talk", thisWsoContext);
  300.                     
  301.                     print("-----------------------> passive character pushWalkActionPoint");
  302.                     local walkQueueEntry = this.pushWalkActionPoint("pm_talk"..talkType, interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);
  303.  
  304.                     
  305.                     -- start action for this character
  306. --                    if (thisWso.walkToActionPoint(interactionPoint.getPassiveActionPoint())) then
  307. --                        thisWso.queueMessage("waitForChar", this, "talk", thisWsoContext);
  308. --                    else
  309. --                        print("no path found");
  310. --                        instantAbort(this, EMOTICON_NOPATH, "emoThink")
  311. --                    end
  312.  
  313.                 else
  314.                     print("no path found");
  315.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  316.                 end
  317.             else
  318.                 print("no interaction point found");
  319.                 instantAbort(character, EMOTICON_NOPATH, "emoThink")
  320.             end
  321.         else
  322.             -- activity not possible
  323.             print(msg.name .. " not possible");
  324.             --sendMsg("sad", character.mimicSO);
  325.             -- instantAbort(character, EMOTICON_SHY, "emoRefuseChar", this)
  326.             instantAbort(character, EMOTICON_SAD, "emoRefuseChar", this)
  327.         end
  328.     end )
  329.         
  330.         
  331.     -- cutscene talk
  332.     onMsg("talkMarryMe", function(msg)
  333.         
  334.         -- get character who initiated this action
  335.         local character = getStateObjectFromID(msg.sender);
  336.         
  337.         print(">>+>> onMsg talkMarryMe character " .. character.getCharacterName() .. " -> " .. getCharacterName());
  338.         
  339.         -- marry here
  340.         instantAbort(character);
  341.         
  342.         
  343.         
  344.     end )
  345.         
  346.         
  347.     -- cutscene talk
  348.     onMsg("talkCutscene", function(msg)
  349.  
  350.         -- get the game object server
  351.         local gameObjectServer = getGameObjectServer();
  352.         -- get character who initiated this action
  353.         local character = getStateObjectFromID(msg.sender);
  354.         
  355.         --if (instantAbortIfNotIdle(character, this)) then return end;
  356.         
  357.         print(">>>>> onMsg talkCutscene character " .. character.getCharacterName() .. " -> " .. getCharacterName() .. " topic " .. msg.data);
  358.         
  359.         --if (character.isSwimming() or this.isSwimming()) then return end;
  360.  
  361. --        if (character.isSwimming() or this.isSwimming()) then 
  362. --            print("no path found");
  363. --            instantAbort(character, EMOTICON_NOPATH, "emoThink")
  364. --            return
  365. --        end;
  366.  
  367.         
  368.         -- walk to the interaction point
  369.  
  370.         -- get the walk state objects
  371.         local wso = character.walkSO;
  372.         local thisWso = this.walkSO;
  373.         -- create state machine contexts
  374.         local wsoContext =  StateMachineContext();
  375.         local thisWsoContext =  StateMachineContext();
  376.         -- store the partners
  377.         wsoContext.storeStateObject("partner", thisWso);
  378.         wsoContext.storeData("activePart", true);
  379.         wsoContext.storeData("topic", msg.data);
  380.         thisWsoContext.storeStateObject("partner", wso);
  381.         thisWsoContext.storeData("activePart", false);
  382.         thisWsoContext.storeData("waitLong", isIdle(this));
  383.         thisWsoContext.storeData("topic", msg.data);
  384.  
  385.         local interactionPoint = findInteractionPoint("talk", character);
  386.         if (interactionPoint) then
  387.  
  388.             -- start action for other character
  389.             if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  390.                 -- wso.queueMessage("waitForChar", this, "talkCutscene", wsoContext);
  391.                 wso.queueStateMachine("interaction.talkCutscene", this, wsoContext);
  392.  
  393.                 -- queue walk and state change msg for this(passive) character
  394.                 local passiveMsg = QueuedMessage();
  395.                 -- passiveMsg.set("waitForChar", this.getUniqueID(), "talkCutscene", thisWsoContext);
  396.                 passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.talkCutscene", thisWsoContext);
  397.                 print("-----------------------> passive character pushWalkActionPoint");
  398.                 local walkQueueEntry = this.pushWalkActionPoint("pm_talkCutscene", interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);
  399.                 
  400.                 
  401.                 
  402.             else
  403.                 print("talkCutscene - no path found");
  404.                 --instantAbort(character, EMOTICON_NOPATH, "emoThink")
  405.  
  406. --                wso.queueStateMachine("interaction.talkCutscene", this, wsoContext);
  407. --                thisWso.queueStateMachine("interaction.talkCutscene", this, thisWsoContext);
  408.  
  409.                 character.sendDelayedMsg("talking", getGameObjectServer().mission, 500, msg.data);
  410.     
  411.             end
  412.         else
  413.             print("talkCutscene - no interaction point found");
  414.             --instantAbort(character, EMOTICON_CANNOT, "emoThink")
  415.  
  416. --            wso.queueStateMachine("interaction.talkCutscene", this, wsoContext);
  417. --            thisWso.queueStateMachine("interaction.talkCutscene", this, thisWsoContext);
  418.  
  419.             character.sendDelayedMsg("talking", getGameObjectServer().mission, 500, msg.data);
  420.  
  421.         end
  422.  
  423.     end )
  424.         
  425.         
  426.         
  427.         
  428.         
  429.         
  430.         
  431.         
  432.         
  433.         
  434.         
  435.         
  436.         
  437.         
  438.         
  439.     -- generic kiss
  440.     onMsg("kiss", function(msg)
  441.         
  442.         -- get the game object server
  443.         local gameObjectServer = getGameObjectServer();
  444.         -- get character who initiated this action
  445.         local character = getStateObjectFromID(msg.sender);
  446.         -- get the suffix
  447.         local kissType = msg.data;
  448.         
  449.         --if (instantAbortIfNotIdle(character, this)) then return end;
  450.         
  451.         if instantAbortIfUnhappy(character, "kiss" .. kissType, this) then return end;        
  452.         
  453.         
  454. --        local actionPointName = "kiss";
  455. --        if (kissType == "Sexy") actionPointName = "talk"; end; -- hack, bad animation
  456.         
  457.         -- check if the activity is possible
  458.         --if (activityPossible(character, "kiss" .. kissType, this) and isIdle(this)) then
  459.         if (activityPossible(character, "kiss" .. kissType, this)) then
  460.         
  461.             -- walk to the interaction point
  462.             local interactionPoint = findInteractionPoint("kiss", character);
  463.             if (interactionPoint) then
  464.                 -- get the walk state objects
  465.                 local wso = character.walkSO;
  466.                 local thisWso = this.walkSO;
  467.                 -- create state machine contexts
  468.                 local wsoContext =  StateMachineContext();
  469.                 local thisWsoContext = StateMachineContext();
  470.                 -- store the partners
  471.                 wsoContext.storeStateObject("partner", thisWso);
  472.                 wsoContext.storeData("activePart", true);
  473.                 wsoContext.storeData("kissType", kissType);
  474.                 thisWsoContext.storeStateObject("partner", wso);
  475.                 thisWsoContext.storeData("activePart", false);
  476.                 thisWsoContext.storeData("kissType", kissType);
  477.                 thisWsoContext.storeData("waitLong", isIdle(this));
  478.                 -- start action for other character
  479.                 if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  480.                     -- wso.queueMessage("waitForChar", this, "kiss", wsoContext);
  481.                     wso.queueStateMachine("interaction.kiss", this, wsoContext);
  482.  
  483.                     -- queue walk and state change msg for this(passive) character
  484.                     local passiveMsg = QueuedMessage();
  485.                     -- passiveMsg.set("waitForChar", this.getUniqueID(), "kiss", thisWsoContext);
  486.                     passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.kiss", thisWsoContext);
  487.  
  488.                     print("-----------------------> passive character pushWalkActionPoint");
  489.                     local walkQueueEntry = this.pushWalkActionPoint("pm_kiss"..kissType , interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);
  490.                 else
  491.                     print("no path found");
  492.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  493.                 end
  494.             else
  495.                 print("no interaction point found");
  496.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  497.             end
  498.         else
  499.             -- activity not possible
  500.             print(msg.name .. " not possible");
  501.             --sendMsg("sad", character.mimicSO);
  502.             --instantAbort(character, EMOTICON_SHY, "emoRefuseChar", this)
  503.             instantAbort(character, EMOTICON_SAD, "emoRefuseChar", this)
  504.         end
  505.     end )
  506.  
  507.  
  508.  
  509.  
  510.  
  511.     -- kissSexy kiss special: has loop
  512.     onMsg("kissSexy", function(msg)
  513.         
  514.         -- get the game object server
  515.         local gameObjectServer = getGameObjectServer();
  516.         -- get character who initiated this action
  517.         local character = getStateObjectFromID(msg.sender);
  518.         -- get the suffix
  519.         local kissType = msg.data;
  520.         
  521.         --if (instantAbortIfNotIdle(character, this)) then return end;
  522.         
  523.         if instantAbortIfUnhappy(character, msg.name, this) then return end;        
  524.  
  525.                 
  526.         -- check if the activity is possible
  527.         --if (activityPossible(character, msg.name, this) and isIdle(this)) then
  528.         if (activityPossible(character, msg.name, this)) then
  529.         
  530.             -- walk to the interaction point
  531.             local interactionPoint = findInteractionPoint("talk", character);
  532.             if (interactionPoint) then
  533.                 -- get the walk state objects
  534.                 local wso = character.walkSO;
  535.                 local thisWso = this.walkSO;
  536.                 -- create state machine contexts
  537.                 local wsoContext =  StateMachineContext();
  538.                 local thisWsoContext = StateMachineContext();
  539.                 -- store the partners
  540.                 wsoContext.storeStateObject("partner", thisWso);
  541.                 wsoContext.storeData("activePart", true);
  542.                 wsoContext.storeData("kissType", kissType);
  543.                 thisWsoContext.storeStateObject("partner", wso);
  544.                 thisWsoContext.storeData("activePart", false);
  545.                 thisWsoContext.storeData("kissType", kissType);
  546.                 thisWsoContext.storeData("waitLong", isIdle(this));
  547.                 -- start action for other character
  548.                 if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  549.                     -- wso.queueMessage("waitForChar", this, "kissSexy", wsoContext);
  550.                     wso.queueStateMachine("interaction.kissSexy", this, wsoContext);
  551.  
  552.                     -- queue walk and state change msg for this(passive) character
  553.                     local passiveMsg = QueuedMessage();
  554.                     -- passiveMsg.set("waitForChar", this.getUniqueID(), "kissSexy", thisWsoContext);
  555.                     passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.kissSexy", thisWsoContext);
  556.                     
  557.                     print("-----------------------> passive character pushWalkActionPoint");
  558.                     local walkQueueEntry = this.pushWalkActionPoint("pm_kissSexy", interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);
  559.  
  560.                     
  561. --                    -- start action for this character
  562. --                    if (thisWso.walkToActionPoint(interactionPoint.getPassiveActionPoint())) then
  563. --                        thisWso.queueMessage("waitForChar", this, "kissSexy", thisWsoContext);
  564. --                    else
  565. --                        print("no path found");
  566. --                        instantAbort(this, EMOTICON_NOPATH, "emoThink")
  567. --                    end
  568.                 else
  569.                     print("no path found");
  570.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  571.                 end
  572.             else
  573.                 print("no interaction point found");
  574.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  575.             end
  576.         else
  577.             -- activity not possible
  578.             print(msg.name .. " not possible");
  579.             --sendMsg("sad", character.mimicSO);
  580.             --instantAbort(character, EMOTICON_SHY, "emoRefuseChar", this)
  581.             instantAbort(character, EMOTICON_SAD, "emoRefuseChar", this)
  582.         end
  583.     end )
  584.  
  585.  
  586.  
  587.  
  588.  
  589.     
  590.     
  591.     
  592.     -- getIntimateSofa
  593.     onMsg("getIntimateSofa", function(msg)
  594.         
  595.         -- get character who initiated this action
  596.         local character = getStateObjectFromID(msg.sender);
  597.         -- get the sofa on wcjich this character is sitting
  598.         local sofa = this.getObjectWithActivity("sit");
  599.         if ((not sofa) or (not sofa.hasBehavior("sofa"))) then
  600.             instantAbort(character, EMOTICON_NOSOFA, "emoThink");
  601.             return
  602.         end
  603.         
  604.         -- get the walk state objects
  605.         local wso = character.walkSO;
  606.         local thisWso = this.walkSO;
  607.         
  608.         local thisActionPointName = thisWso.retrieveData("actionPointName");
  609.         if (not thisActionPointName) then
  610.             print("getIntimateSofa: thisActionPointName == nil");
  611.             instantAbort(character, EMOTICON_CANNOT, "emoThink");
  612.             return
  613.         end
  614.         
  615.         local actionPointName = nil;
  616.         local mirrorAnims = false;
  617.         
  618.         
  619.         
  620.  
  621.         local thisMale = this.isMale();
  622.         
  623.         print("--------------getIntimateSofa passive character on actionpoint:" .. thisActionPointName .. " male:" .. tostring(thisMale));
  624.         if (thisActionPointName == "sit1") then 
  625.             if (thisMale) then
  626.                 actionPointName = "sit2";
  627.             else
  628.                 actionPointName = "sit2";
  629.                 mirrorAnims = true;
  630.             end
  631.         elseif (thisActionPointName == "sit2") then
  632.             if (thisMale) then
  633.                 actionPointName = "sit3";
  634.             else
  635.                 actionPointName = "sit1";
  636.             end
  637.         elseif (thisActionPointName == "sit3") then
  638.             if (thisMale) then
  639.                 actionPointName = "sit2";
  640.                 mirrorAnims = true;
  641.             else
  642.                 actionPointName = "sit2";
  643.             end
  644.         else
  645.             print("getIntimateSofa passive character on unknown actionpoint:" .. thisActionPointName)
  646.             instantAbort(character, EMOTICON_CANNOT, "emoThink");
  647.         end
  648.         
  649.         print("--------------getIntimateSofa active character to actionpoint:" .. actionPointName .. " mirrorAnims:" .. tostring(mirrorAnims));
  650.  
  651.         
  652.         local actionPoint = character.getClosestFreeActionPoint(character, sofa, {actionPointName});
  653.         
  654.         print("--------------getIntimateSofa getClosestFreeActionPoint returned actionpoint:" .. actionPoint.getName());
  655.  
  656.         if (actionPoint) then
  657.         
  658.             -- create state machine contexts
  659.             local wsoContext =  StateMachineContext();
  660.             local thisWsoContext =  StateMachineContext();
  661.                         
  662.                                 
  663.             if (wso.walkToActionPoint(actionPoint)) then
  664.             
  665.                 wsoContext.storeData("actionPointName", actionPoint.getName());
  666.                 
  667.                 wsoContext.storeStateObject("partner", thisWso);
  668.                 wsoContext.storeStateObject("sofa", sofa);
  669.                 wsoContext.storeData("sitState", "waitIntimate");
  670.                 wsoContext.storeData("activePart", true);
  671.                 wsoContext.storeData("mirrorAnims", mirrorAnims);
  672.                 
  673.                 thisWso.storeStateObject("partner", wso);
  674.                 thisWso.storeStateObject("sofa", sofa);
  675.                 thisWso.storeData("activePart", false);
  676.                 thisWso.storeData("mirrorAnims", mirrorAnims);
  677.             
  678.             
  679.                 print("getIntimateSofa sendMsg waitIntimate & queueStateMachine sofaChar.sitDownToGetIntimate");
  680.                 --wso.queueStateMachine("sofaChar.sitDownToGetIntimate", this, wsoContext);
  681.                 wso.queueStateMachine("sofaChar.sitDown", sofa, wsoContext);
  682.                 sendMsg("waitIntimate", thisWso);
  683.                 
  684.             else
  685.                 print("no path found");
  686.                 instantAbort(character, EMOTICON_NOPATH, "emoThink");
  687.                 return
  688.             end
  689.             
  690.             
  691. --            thisWso.setState("waitIntimate");
  692. --            thisWso.queueStateMachine("sofaChar.waitIntimate", this, thisWsoContext);
  693.         else
  694.             print("mike.lua::getIntimateSofa: no action point found " .. actionPointName);
  695.             instantAbort(character, EMOTICON_CANNOT, "emoThink");
  696.         end
  697.     end )
  698.     
  699.     
  700.     
  701.     -- getIntimateSofaShortcut
  702.     onMsg("getIntimateSofaShortcut", function(msg)
  703.     
  704.         print("onMsg getIntimateSofaShortcut");
  705.         
  706.         -- get character who initiated this action
  707.         local character = getStateObjectFromID(msg.sender);
  708.                     
  709.         -- get the walk state objects
  710.         local wso = character.walkSO;
  711.         local thisWso = this.walkSO;
  712.         
  713.         local possible, mirrorAnims = getSofaIteractionInfo(character, this);
  714.                 
  715.         wso.storeStateObject("partner", thisWso);
  716.         wso.storeData("activePart", true);
  717.         wso.storeData("mirrorAnims", mirrorAnims);
  718.         
  719.         thisWso.storeStateObject("partner", wso);
  720.         thisWso.storeData("activePart", false);
  721.         thisWso.storeData("mirrorAnims", mirrorAnims);
  722.         
  723.         --thisWso.setState("waitIntimate");
  724.         sendMsg("waitIntimate", thisWso);
  725.             
  726.     end )    
  727.     
  728.     
  729.     
  730.     
  731.     -- getIntimate
  732.     onMsg("getIntimateBed", function(msg)
  733.         -- get character who initiated this action
  734.         local character = getStateObjectFromID(msg.sender);
  735.         -- get the bed on wcjich this character is laying
  736.         local bed = this.getObjectWithActivity("sleep");
  737.         
  738.         print("onMsg getIntimate: no partner in bed");
  739.         
  740.         if instantAbortIfUnhappy(character, "getIntimateBed", this) then return end;        
  741.         
  742.         
  743.         if (not bed) then
  744.             print("   getIntimate: no partner in bed");
  745.             
  746.             --if (instantAbortIfNotIdle(character, this)) then return end;
  747.             
  748.             local freeBed, actionPoint1, actionPoint2 = findBedForInteraction(this, character);
  749.             if (freeBed) then
  750.             -- get the walk state object
  751.             
  752.                 -- get the walk state objects
  753.                 local wso = character.walkSO;
  754.                 local thisWso = this.walkSO;
  755.                 
  756.                 if (wso.walkToActionPoint(actionPoint2)) then
  757.                 
  758. --                    if (thisWso.walkToActionPoint(actionPoint1)) then
  759.                     
  760.                         print("free double bed found");
  761.                     
  762.                         -- create state machine contexts
  763.                         local wsoContext =  StateMachineContext();
  764.                         local thisWsoContext =  StateMachineContext();
  765.                                     
  766.                         wsoContext.storeData("actionPointName", actionPoint2.getName());
  767.                         wsoContext.storeStateObject("partner", thisWso);
  768.                         wsoContext.storeStateObject("bed", freeBed);
  769.                         wsoContext.storeData("activePart", true);
  770.                                     
  771.                         thisWsoContext.storeData("actionPointName", actionPoint1.getName());
  772.                         thisWsoContext.storeStateObject("partner", wso);
  773.                         thisWsoContext.storeStateObject("bed", freeBed);
  774.                         thisWsoContext.storeData("activePart", false);                        
  775.                         
  776.                         --thisWso.queueStateMachine("doublebedChar.layDownToGetIntimate", this, thisWsoContext);
  777.                         wso.queueStateMachine("doublebedChar.layDownToGetIntimate", this, wsoContext);
  778.                         
  779.                         -- queue walk and state change msg for this(passive) character
  780.                         local passiveMsg = QueuedMessage();
  781.                         --passiveMsg.set("enterStateMachine", this.getUniqueID(), "doublebedChar.layDownToGetIntimate", thisWsoContext);
  782.                         passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "doublebedChar.layDownToGetIntimate", thisWsoContext);
  783.                         
  784.                         local walkQueueEntry = this.pushWalkActionPoint("pm_getIntimateBed", actionPoint1, false, passiveMsg, true);
  785.  
  786.                         
  787.                         --this.pushQueueEntry("pm_getIntimateBed");
  788.                         --setTopQueueEntry(this, "pm_getIntimateBed");
  789. --                    else
  790. --                        print("no path found");
  791. --                        instantAbort(this, EMOTICON_NOPATH, "emoThink")
  792. --                    end
  793.                 else
  794.                     print("no path found");
  795.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  796.                 end
  797.             else
  798.                 print("getIntimate: no action point found of layDown1, layDown2");
  799.                 instantAbort(character, EMOTICON_NODOUBLEBED, "emoThink")
  800.             end
  801.             
  802.             
  803.         else
  804.         
  805.             local actionPoint = character.getClosestFreeActionPoint(character, bed, {"layDown1", "layDown2"});
  806.             if (actionPoint) then
  807.             -- get the walk state object
  808.             
  809.                 -- get the walk state objects
  810.                 local wso = character.walkSO;
  811.                 local thisWso = this.walkSO;
  812.                 -- create state machine contexts
  813.                 local wsoContext =  StateMachineContext();
  814.                 local thisWsoContext =  StateMachineContext();
  815.                             
  816.                 wsoContext.storeData("actionPointName", actionPoint.getName());
  817.                 
  818.                 wsoContext.storeStateObject("partner", thisWso);
  819.                 wsoContext.storeStateObject("bed", bed);
  820.                 wsoContext.storeData("activePart", true);
  821.                             
  822.                 thisWso.storeStateObject("partner", wso);
  823.                 thisWso.storeStateObject("bed", bed);
  824.                 thisWso.storeData("activePart", false);
  825.                 
  826.                 if (wso.walkToActionPoint(actionPoint)) then
  827.                     wso.queueStateMachine("doublebedChar.layDownToGetIntimate", this, wsoContext);
  828.                 else
  829.                     print("no path found");
  830.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  831.                 end
  832.                 
  833.                 thisWso.setState("waitIntimate");
  834.             else
  835.                 print("getIntimate: no action point found of layDown1, layDown2");
  836.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  837.             end
  838.         
  839.         
  840.         end
  841.                 
  842.     end )
  843.     
  844.     
  845.     
  846.     
  847.     
  848.     -- getIntimateBedShortcut
  849.     onMsg("getIntimateBedShortcut", function(msg)
  850.         print("onMsg getIntimateBedShortcut");
  851.  
  852.         -- get character who initiated this action
  853.         local character = getStateObjectFromID(msg.sender);
  854.         -- get the bed on wcjich this character is laying
  855.         local bed = this.getObjectWithActivity("lie");
  856.         
  857.                 
  858.         -- get the walk state objects
  859.         local wso = character.walkSO;
  860.         local thisWso = this.walkSO;
  861.                     
  862.         
  863.         wso.storeStateObject("partner", thisWso);
  864.         wso.storeStateObject("bed", bed);
  865.         wso.storeData("activePart", true);
  866.         
  867.         
  868.         thisWso.storeStateObject("partner", wso);
  869.         thisWso.storeStateObject("bed", bed);
  870.         thisWso.storeData("activePart", false);
  871.                     
  872.         --wso.setState("waitIntimate");
  873.         thisWso.setState("waitIntimate");
  874.     end )
  875.     
  876.     
  877.     
  878.     
  879.     
  880.     
  881.     
  882.     
  883.     -- kissBed
  884.     onMsg("kissBed", function(msg)
  885.         print("character onMsg kissBed");
  886.         -- get character who initiated this action
  887.         local character = getStateObjectFromID(msg.sender);
  888.         
  889.         if not getInteractionBed(this, character) then
  890.             instantAbort(character)
  891.             return
  892.         end
  893.                         
  894.         character.walkSO.storeData("activePart", true);
  895.         this.walkSO.storeData("activePart", false);
  896.                 
  897.         sendMsg("kissBed", character.walkSO);        
  898.         sendMsg("kissBed", this.walkSO);        
  899.     end )    
  900.     
  901.     -- pettingBed
  902.     onMsg("pettingBed", function(msg)
  903.         print("character onMsg pettingBed");
  904.         -- get character who initiated this action
  905.         local character = getStateObjectFromID(msg.sender);
  906.                 
  907.         if not getInteractionBed(this, character) then
  908.             instantAbort(character)
  909.             return
  910.         end
  911.                         
  912.         character.walkSO.storeData("activePart", true);
  913.         this.walkSO.storeData("activePart", false);
  914.                 
  915.         sendMsg("pettingBed", character.walkSO);        
  916.         sendMsg("pettingBed", this.walkSO);        
  917.     end )
  918.         
  919.     -- sexBed
  920.     onMsg("sexBed", function(msg)
  921.         print("character onMsg sexBed");
  922.         -- get character who initiated this action
  923.         local character = getStateObjectFromID(msg.sender);
  924.         
  925.         if not getInteractionBed(this, character) then
  926.             instantAbort(character)
  927.             return
  928.         end
  929.                         
  930.         character.walkSO.storeData("activePart", true);
  931.         this.walkSO.storeData("activePart", false);
  932.                 
  933.         sendMsg("sexBed", character.walkSO);        
  934.         sendMsg("sexBed", this.walkSO);    
  935.  
  936.     end )    
  937.     
  938.     
  939.     
  940.     
  941.     
  942.     -- holdNice
  943.     onMsg("holdNice", function(msg)
  944.         -- get the game object server
  945.         local gameObjectServer = getGameObjectServer();
  946.         -- get character who initiated this action
  947.         local character = getStateObjectFromID(msg.sender);        
  948.         
  949.         --if (instantAbortIfNotIdle(character, this)) then return end;
  950.         if instantAbortIfUnhappy(character, msg.name, this) then return end;        
  951.         
  952.         -- check if the activity is possible
  953.         --if (activityPossible(character, msg.name, this) and isIdle(this)) then
  954.         if (activityPossible(character, msg.name, this)) then
  955.         
  956.             -- walk to the interaction point
  957.             local interactionPoint = findInteractionPoint("hug", character);
  958.             if (interactionPoint) then
  959.                 -- get the walk state objects
  960.                 local wso = character.walkSO;
  961.                 local thisWso = this.walkSO;
  962.                 -- create state machine contexts
  963.                 local wsoContext =  StateMachineContext();
  964.                 local thisWsoContext = StateMachineContext();
  965.                 -- store the partners
  966.                 wsoContext.storeStateObject("partner", thisWso);
  967.                 wsoContext.storeData("activePart", true);
  968.                 thisWsoContext.storeStateObject("partner", wso);
  969.                 thisWsoContext.storeData("activePart", false);
  970.                 thisWsoContext.storeData("waitLong", isIdle(this));
  971.                 -- start action for other character
  972.                 if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  973.                     -- wso.queueMessage("waitForChar", this, "holdNice", wsoContext);
  974.                     wso.queueStateMachine("interaction.holdNice", this, wsoContext);
  975.                     
  976.                     -- queue walk and state change msg for this(passive) character
  977.                     local passiveMsg = QueuedMessage();
  978.                     -- passiveMsg.set("waitForChar", this.getUniqueID(), "holdNice", thisWsoContext);
  979.                     passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.holdNice", thisWsoContext);
  980.  
  981.                     print("-----------------------> passive character pushWalkActionPoint");
  982.                     local walkQueueEntry = this.pushWalkActionPoint("pm_holdNice", interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);
  983.  
  984.  
  985.                     
  986. --                    -- start action for this character
  987. --                    if (thisWso.walkToActionPoint(interactionPoint.getPassiveActionPoint())) then
  988. --                        thisWso.queueMessage("waitForChar", this, "holdNice", thisWsoContext);
  989. --                    else
  990. --                        print("no path found");
  991. --                        instantAbort(this, EMOTICON_NOPATH, "emoThink")
  992. --                    end
  993.                 else
  994.                     print("no path found");
  995.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  996.                 end
  997.             else
  998.                 print("no interaction point found");
  999.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1000.             end
  1001.         else
  1002.             -- activity not possible
  1003.             print(msg.name .. " not possible");
  1004.             sendMsg("sad", character.mimicSO);
  1005.             instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1006.         end
  1007.     end )
  1008.     
  1009.         
  1010.     
  1011.     
  1012.     
  1013.     
  1014.     -- holdBehind
  1015.     onMsg("holdBehind", function(msg)
  1016.         -- get the game object server
  1017.         local gameObjectServer = getGameObjectServer();
  1018.         -- get character who initiated this action
  1019.         local character = getStateObjectFromID(msg.sender);
  1020.         
  1021.         --if (instantAbortIfNotIdle(character, this)) then return end;        
  1022.         if instantAbortIfUnhappy(character, msg.name, this) then return end;        
  1023.         
  1024.         -- check if the activity is possible
  1025.         if (activityPossible(character, msg.name, this)) then
  1026.         
  1027.             -- walk to the interaction point
  1028.             local interactionPoint = findInteractionPoint("behind", character);
  1029.             if (interactionPoint) then
  1030.                 -- get the walk state objects
  1031.                 local wso = character.walkSO;
  1032.                 local thisWso = this.walkSO;
  1033.                 -- create state machine contexts
  1034.                 local wsoContext =  StateMachineContext();
  1035.                 local thisWsoContext = StateMachineContext();
  1036.                 -- store the partners
  1037.                 wsoContext.storeStateObject("partner", thisWso);
  1038.                 wsoContext.storeData("activePart", true);
  1039.                 thisWsoContext.storeStateObject("partner", wso);
  1040.                 thisWsoContext.storeData("activePart", false);
  1041.                 thisWsoContext.storeData("waitLong", isIdle(this));
  1042.                 -- start action for other character
  1043.                 if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  1044.                     -- wso.queueMessage("waitForChar", this, "holdBehind", wsoContext);
  1045.                     wso.queueStateMachine("interaction.holdBehind", this, wsoContext);
  1046.                                         
  1047.                     -- queue walk and state change msg for this(passive) character
  1048.                     local passiveMsg = QueuedMessage();
  1049.                     passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.holdBehind", thisWsoContext);
  1050.  
  1051.                     local walkQueueEntry = this.pushWalkActionPoint("pm_holdBehind", interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);                    
  1052.  
  1053.                                         
  1054. --                    -- start action for this character
  1055. --                    if (thisWso.walkToActionPoint(interactionPoint.getPassiveActionPoint())) then
  1056. --                        thisWso.queueMessage("waitForChar", this, "holdBehind", thisWsoContext);
  1057. --                    else
  1058. --                        print("no path was found");
  1059. --                        this.setEmoticon(EMOTICON_NOPATH, EMOTICON_DELAY);
  1060. --                        sendMsg("emoThink", this.walkSO);
  1061. --                    end
  1062.                 else
  1063.                     print("no path was found");
  1064.                     instantAbort(character, EMOTICON_NOPATH, "emoThink")
  1065.                 end
  1066.             else
  1067.                 print("no interaction point found");
  1068.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1069.             end
  1070.         else
  1071.             -- activity not possible
  1072.             print(msg.name .. " not possible");
  1073.             sendMsg("sad", character.mimicSO);
  1074.             instantAbort(character, EMOTICON_SAD, "emoRefuseChar")
  1075.         end
  1076.     end )
  1077.     
  1078.     
  1079. --    onMsg("imBackAtHome", function(msg)
  1080. --        if (this.getRememberGift() == true) and (holdObject(this, "gift")) then
  1081. --            print("looking for partner to give the gift")
  1082. --            local partner = getStateObjectFromID(msg.sender);
  1083. --            this.setRememberGift(false);                                
  1084. --            if (partner) then
  1085. --                sendMsg("giveGift", partner);
  1086. --            end            
  1087. --        end
  1088. --    end )
  1089.     
  1090.     -- giveGift
  1091.     onMsg("giveGift", function(msg)
  1092.     
  1093.         -- get the game object server
  1094.         local gameObjectServer = getGameObjectServer();
  1095.         -- get character who initiated this action
  1096.         local character = getStateObjectFromID(msg.sender);
  1097.         
  1098.         print("onMsg giveGift from " .. character.getCharacterName() .. " to " .. this.getCharacterName());        
  1099.  
  1100.         --if (instantAbortIfNotIdle(character, this)) then return end;
  1101.  
  1102.         
  1103.         -- check if the activity is possible        
  1104.         if (activityPossible(character, msg.name, this)) then
  1105.                 
  1106.             if (holdsObject(character, "gift")) then                
  1107.                 -- walk to the interaction point
  1108.                 local interactionPoint = findInteractionPoint("talk", character);
  1109.                 if (interactionPoint) then
  1110.                     -- get the walk state objects
  1111.                     local wso = character.walkSO;
  1112.                     local thisWso = this.walkSO;
  1113.                     -- create state machine contexts
  1114.                     local wsoContext =  StateMachineContext();
  1115.                     local thisWsoContext =  StateMachineContext();
  1116.                     -- store the partners
  1117.                     wsoContext.storeStateObject("partner", thisWso);
  1118.                     wsoContext.storeData("activePart", true);
  1119.                     thisWsoContext.storeStateObject("partner", wso);
  1120.                     thisWsoContext.storeData("activePart", false);
  1121.                     thisWsoContext.storeData("waitLong", isIdle(this));
  1122.                     -- start action for other character
  1123.                     if (wso.walkToActionPoint(interactionPoint.getActiveActionPoint())) then
  1124.                         -- wso.queueMessage("waitForChar", this, "giveGift", wsoContext);
  1125.                         wso.queueStateMachine("interaction.giveGift", this, wsoContext);
  1126.                                         
  1127.                         -- queue walk and state change msg for this(passive) character
  1128.                         local passiveMsg = QueuedMessage();
  1129.                         -- passiveMsg.set("waitForChar", this.getUniqueID(), "giveGift", thisWsoContext);
  1130.                         passiveMsg.set(Message.MSG_RESERVED_EnterStateMachine, this.getUniqueID(), "interaction.giveGift", thisWsoContext);
  1131.  
  1132.                         print("-----------------------> passive character pushWalkActionPoint");
  1133.                         local walkQueueEntry = this.pushWalkActionPoint("pm_giveGift", interactionPoint.getPassiveActionPoint(), false, passiveMsg, true);                    
  1134.  
  1135.                                         
  1136. --                        -- start action for this character
  1137. --                        if (thisWso.walkToActionPoint(interactionPoint.getPassiveActionPoint())) then
  1138. --                            thisWso.queueMessage("waitForChar", this, "giveGift", thisWsoContext);
  1139. --                        else
  1140. --                            print("no path found");
  1141. --                            instantAbort(this, EMOTICON_NOPATH, "emoThink")
  1142. --                        end
  1143.                     else
  1144.                         print("no path found");
  1145.                         instantAbort(character, EMOTICON_NOPATH, "emoThink")
  1146.                     end
  1147.                 else
  1148.                     print("no interaction point found");
  1149.                     instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1150.                 end
  1151.             else
  1152.                 print("no gift to give")
  1153.                 sendMsg("sad", character.mimicSO);
  1154.                 instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1155.             end
  1156.         else
  1157.             -- activity not possible
  1158.             print(msg.name .. " not possible");
  1159.             sendMsg("sad", character.mimicSO);
  1160.             instantAbort(character, EMOTICON_CANNOT, "emoThink")
  1161.         end
  1162.     end )    
  1163.     
  1164.     
  1165.     
  1166.     -- play as this char
  1167.     onMsg("playAsThis", function(msg)
  1168.         getGameObjectServer().setCurrentCharacter(this);
  1169.     end )
  1170.     
  1171. endStateMachine()
  1172.